/*
 * GameObjectFactory.h
 *
 *  Created on: Nov 15, 2009
 *      Author: magnus
 */

#ifndef __SPACEDEFENDER__MODELFACTORY_H_
#define __SPACEDEFENDER__MODELFACTORY_H_
/**
 * The GameObjectFactory handles creation of ALL objects that exists in the model.
 */
#include <string>
#include <map>

namespace spacedefender {
enum Error_t {OK=0,ERROR_NOFILE, ERROR_NO_ELEMENT,ERROR_NO_ATTRIBUTE,ERROR_INVALID_DATA};

#ifndef __gErrorText
#define __gErrorText
#endif
class SpaceshipInfo;
class Spaceship;
class GameObjectReader;
typedef  const SpaceshipInfo* sip;
class GameObjectFactory {
public:
	static GameObjectFactory* GetInstance() {return &_instance; };
	virtual ~GameObjectFactory();

	bool Init(const GameObjectReader* gor);
	Spaceship* CreateSpaceShip(const std::string& id) const;

private:
	GameObjectFactory();
	GameObjectFactory(const GameObjectFactory &) {} ;
	GameObjectFactory& operator=(const GameObjectFactory &rhs) { return *this; }

	static GameObjectFactory _instance;

	std::map<std::string, sip> _objects;

};

}

#endif /* __SPACEDEFENDER__MODELFACTORY_H_ */
